package com.lagou.order.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lagou.common.pojo.Goods;
import com.lagou.common.pojo.GoodsVo;
import com.lagou.common.pojo.Orders;
import com.lagou.common.pojo.OrdersVo;
import com.lagou.order.mapper.OrdersMapper;
import com.lagou.order.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrdersServiceImpl implements OrdersService {
    @Autowired
    private OrdersMapper ordersMapper;


    @Override
    public Orders queryById(Integer id) {
        return ordersMapper.selectById(id);
    }

    @Override
    public OrdersVo queryList(Integer current, Integer size) {
        OrdersVo ordersVo=new OrdersVo();
        IPage<Orders> page = new Page<>(current, size);
        ordersMapper.selectPage(page,null);
        ordersVo.setCurrent(current);
        ordersVo.setSize(size);
        ordersVo.setTotal(page.getTotal());
        ordersVo.setOrdersList(page.getRecords());
        return ordersVo;
    }
}
